#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    vector<int> searchRange(vector<int>& nums, int target) {
        if (nums.size() == 0) {
            return vector<int>{-1, -1};
        }
        vector<int> v;
        int left = 0;
        int right = nums.size() - 1;
        while (left < right) {
            int mid = left + (right - left) / 2;
            if (nums[mid] >= target)
                right = mid;
            else
                left = mid + 1;
        }
        if (nums[left] != target) {
            v.push_back(-1);
            v.push_back(-1);
            return v;
        }
        v.push_back(left);
        right = nums.size() - 1;
        while (left < right) {
            int mid = left + (right - left) / 2 + 1;
            if (nums[mid] <= target)
                left = mid;
            else
                right = mid - 1;
        }
        v.push_back(left);
        return v;
    }
};
int main()
{
    Solution S;
    vector<int> v = { 5,7,7,8,8,10 };
    int target = 6;
    vector<int> v1 = S.searchRange(v, target);
    for (auto e : v1) {
        cout << e << ' ';
    }
	return 0;
}